			checkIsGetInternet(){
				uni.getNetworkType({
				    success: (res) => {
				        console.log(res.networkType); // 网络类型 wifi、2g、3g、4g、ethernet、unknown、none
				        if (res.networkType === "none") {
				            // 当前无网络
				            uni.showToast({
				                title: '当前无网络连接，本应用大部分功能需要联网才能使用',
				                icon: "none",
				                duration: 10000
				            });
				        } else {
				            // 有网络
							console.log("用户当前已连接网络！")
				             this.initConnect();
				        }
				    },
				    fail: (err) => {
				        console.error('获取网络类型失败:', err);
				        uni.showToast({
				            title: '获取网络状态失败',
				            icon: "none",
				            duration: 3000
				        });
				    }
				});
				uni.onNetworkStatusChange((res)=> {
							let title = `您当前处于${res.networkType}网络，请您安心享用LINK为您带来的服务`
				            if(res.networkType=='none'){
								title ='您的网络连接已断开';
								this.$websocket.close()
								//主动关闭之后，就不会收到之前断开的websocket请求发来的注销通知，进而可以无缝重新连接.
							}
							else{
								 this.initConnect();
							}
							if(res.networkType=='5g'||res.networkType=='4g')title=`您当前处于${res.networkType}网络，请时刻注意流量是否足够使用`
							uni.showToast({
								title,
								icon: 'none',
								duration:3000
							});
				});
			},
			initConnect(){
				var uid=uni.getStorageSync('UID')||null
				var token=uni.getStorageSync("token")||null
				console.log('uid',uid)
				console.log('token',token)
				if(uid!=null&&token!=null){
					this.$websocket.connect(uid,token)
				}
			},
			enablPermission(){
				let main = plus.android.runtimeMainActivity();
				let pkName = main.getPackageName();
				let uid = main.getApplicationInfo().plusGetAttribute("uid");
				let NotificationManagerCompat = plus.android.importClass("android.support.v4.app.NotificationManagerCompat");
				//android.support.v4升级为androidx
				if (NotificationManagerCompat == null) {
					NotificationManagerCompat = plus.android.importClass("androidx.core.app.NotificationManagerCompat");
				}
				let areNotificationsEnabled = NotificationManagerCompat.from(main).areNotificationsEnabled();
				// 未开通‘允许通知'权限，则弹窗提醒开通，并点击确认后，跳转到系统设置页面进行设置  
				if (!areNotificationsEnabled) {
					uni.showModal({
						title: '通知权限开启提醒',
						content: '您还没有开启通知权限，无法接受到消息通知，请前往设置！',
						showCancel: false,
						confirmText: '知道了',
						success: function(res) {
							if (res.confirm) {
								uni.showToast({
									title:'快去开启通知吧',
									icon:none,
									duration:3000
								})
							}
						}
					});
				}
			},
			wakeLock() {
			    //Android  
			    var main = plus.android.runtimeMainActivity();  
			    var Context = plus.android.importClass("android.content.Context");  
			    var PowerManager = plus.android.importClass("android.os.PowerManager");  
			    var pm = main.getSystemService(Context.POWER_SERVICE);  
			    this.g_wakelock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "ANY_NAME");  
			    this.g_wakelock.acquire();  
			} ,
			//结束程序后台运行  
			 releaseWakeLock () {  
			    if(g_wakelock != null && g_wakelock.isHeld()) {  
			       this. g_wakelock.release();  
			        this.g_wakelock = null;  
			    }  
			}
module.exports={checkIsGetInternet,enablPermission,wakeLock}